<template>
  <div id="app">
    <transition :name="transitionName">
      <router-view></router-view>
    </transition>
  </div>
</template>

<script>
import { getLocal } from '@/utils/cache';

export default {
  name: 'App',
  data () {
    return {
      transitionName: ''
    }
  },
  created () {
    this._isLogin()
      // 暂无用处
      document.body.addEventListener('touchstart', function () { })
  },
  methods: {
    // 判断是否登录
    _isLogin () {
      // var token = getLocal("wyxuan_token");
      // console.log(token);
      // if (!token) {
      //   this.$router.push("/login");
      // } else {
      // //  this.$router.push("/");
      // }
    }
  },
  watch: {
    $route (to, from) {
      const toDepth = to.path.split('/').length
      const fromDepth = from.path.split('/').length
      this.transitionName = toDepth < fromDepth ? 'slide-right' : 'slide-left';
    }
  }
}
</script>

<style lang="scss" scoped>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  background: #fff;
  min-height: 100vh;
}
.fixed {
  position: fixed;
  left: 0;
  right: 0;
}
</style>
